package com.twu.biblioteca;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class MenuParser {

    private BufferedReader in;

    public MenuParser(BufferedReader in) {
        this.in = in;
    }

    public MenuParser(InputStream in) {
        this(new BufferedReader(new InputStreamReader(in)));
    }

    public MenuOption userOption() {
        try {
            try (BufferedReader reader = in) {
                String input = reader.readLine();
                if ("1".equals(input)) {
                    return MenuOption.List_Books;
                }
            }
        } catch (IOException e) {
            return null;
        }
        return null;
    }
}
